package com.thor.palmmall.rest.order.converter;

import org.springframework.core.convert.converter.Converter;

import com.thor.palmmall.rest.order.AProductCondition;
import com.thor.palmmall.spi.order.SProductCondition;

public class SProductConditionConverter implements
			Converter<AProductCondition, SProductCondition> {

	public static SProductConditionConverter getInstance() {
		if (instance == null)
			instance = new SProductConditionConverter();
		return instance;
	}

	private static SProductConditionConverter instance;

	private SProductConditionConverter() {
	}

	@Override
	public SProductCondition convert(AProductCondition source) {
		if (source == null){
		    return null;
		}
		SProductCondition sProductCondition = new SProductCondition();
		sProductCondition.setPage(source.getPage());
		sProductCondition.setPageSize(source.getPageSize());
		sProductCondition.setFilter(SProductConditionFilterConverter.getInstance().convert(source.getFilter()));
		return sProductCondition;
	}
}
